﻿using System.Windows;
using System.Windows.Controls;

namespace Manager.gui
{
	/// <summary>
	/// Lógica de interacción para Window1.xaml
	/// </summary>
	public partial class DialogNewRace : Window
	{
		public Race race { get; private set; }

		public DialogNewRace()
		{
			InitializeComponent();
			race = new Race();
		}
		public DialogNewRace(Race r)
		{
			InitializeComponent();
			race = r;
			textBoxRaceName.Text = race.Name;
			comboBoxRaceType.Text = race.Type;
			comboBoxSize.Text = race.Size;
		}

		private void okButton_Click(object sender, RoutedEventArgs e)
		{
			if (textBoxRaceName.Text == "")
				return;
			else
			{
				race.Name = textBoxRaceName.Text;
				race.Type = ((ComboBoxItem)comboBoxRaceType.SelectedItem).Content.ToString();
				race.Size = ((ComboBoxItem)comboBoxSize.SelectedItem).Content.ToString();
				this.DialogResult = true;
			}

		}

		private void cancelButton_Click(object sender, RoutedEventArgs e)
		{
			this.DialogResult = false;
		}
	}
}
